package com.wd.live.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.ViewModel;

import com.wd.live.base.BaseViewModel;
import com.wd.live.bean.LiveTypeListBean;
import com.wd.live.bean.YueBean;
import com.wd.live.model.HttpUtils;

import java.util.Map;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

/**
 * <p>项目名称:LookFor2.0</p>
 * <p>包名:com.wd.live.viewmodel</p>
 * <p>简述:</p>
 *
 * @author 孟令高
 * @date 2022/11/30
 */
public class MyMoneyViewModel extends BaseViewModel {


    public MyMoneyViewModel(@NonNull Application application) {
        super(application);
    }


    //查询直播类型
    private MediatorLiveData<YueBean> liveData=new MediatorLiveData<>();
    public  MediatorLiveData<YueBean> getyuelist(Map<String,Object> map){
        HttpUtils.getHttpUtils().getApi()
                .getmyyue(map)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<YueBean>() {
                    @Override
                    public void accept(YueBean yueBean) throws Exception {
                        liveData.postValue(yueBean);
                    }
                });

        return liveData;
    }
}
